<template>
  <el-select style="width:100%" size="mini" :value="value" placeholder="请选择" @change="change" :clearable="clearable">
    <slot name="option"></slot>
    <el-option v-for="(item,index) in options" :key="index" :label="item.headline" :value="item.leafletId + ''"></el-option>
  </el-select>
</template>
<script>
import * as api from '@/utils/api'
export default {
  props: {
    clearable: {
      type: Boolean,
      default: false
    },
    value: String
  },
  data() {
    return {
      pload: false,
      options: []
    }
  },
  created() {
    this.getData()
  },
  methods: {
    change(n) {
      this.$emit('input', n)
    },
    async getData() {
      this.pload = false
      const Datas = await api.pageList({
        pageNum: 1,
        pageSize: 1000
      })
      this.options = Datas.data
      this.pload = true
    }
  }
}
</script>
